﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using DHQGHN.DAL.DAO;
using DHQGHN.DAL.DataMapper;
using DHQGHN.DAL.Models;

namespace DHQGHN.DAL.BO
{
    public class AdminMenuBO : BaseBO
    {
        #region Field Name in return DataSet
        //Field Name in return DataSet
        public const string Field_DS_MenuId = "MenuId";
        public const string Field_DS_MenuParentId = "MenuParentId";
        public const string Field_DS_MenuName = "MenuName";
        public const string Field_DS_MenuImageCss = "MenuImageCss";
        public const string Field_DS_MenuCode = "MenuCode";
        public const string Field_DS_Description = "Description";
        public const string Field_DS_ActionCode = "ActionCode";
        public const string Field_DS_MenuClass = "MenuClass";
        public const string Field_DS_MenuUrl = "MenuUrl";
        public const string Field_DS_MenuOrder = "MenuOrder";
        public const string Field_DS_MenuLevel = "MenuLevel";

        public const string Field_DS_IsActive = "IsActive";
        #endregion


        private String _connectionString;
        private AdminMenuDAO _shareDAO;
        public AdminMenuBO(string connString)
        {
            this._connectionString = connString;

        }
        public AdminMenuBO()
        {
            this._connectionString = Common.ConnectionUtil.DHQG_ADMIN_CONNECTION_STRING;
            //this._connectionString = ConfigurationManager.ConnectionStrings["SystemConfig"].ConnectionString;

        }

        public AdminMenuDAO CreateSQLDAO()
        {
            return new AdminMenuDAO(_connectionString, DEFAULT_MAPPER_TYPE);
        }
        /// <summary>
        /// Get All Prople
        /// </summary>
        /// <param name="mapperType"></param>
        /// <returns></returns>
        public List<AdminMenuModel> GetAll()
        {
            try
            {
                _shareDAO = CreateSQLDAO();
                Dictionary<String, String> mapDictionary = new Dictionary<string, string>()
                {
                    {AdminMenuModel.Field_MenuId,Field_DS_MenuId},
                    {AdminMenuModel.Field_MenuParentId,Field_DS_MenuParentId},
                    {AdminMenuModel.Field_MenuName,Field_DS_MenuName},
                    {AdminMenuModel.Field_MenuImageCss,Field_DS_MenuImageCss},
                    {AdminMenuModel.Field_MenuCode,Field_DS_MenuCode},
                    {AdminMenuModel.Field_Description,Field_DS_Description},
                    {AdminMenuModel.Field_ActionCode,Field_DS_ActionCode},
                    {AdminMenuModel.Field_MenuClass,Field_DS_MenuClass},
                    {AdminMenuModel.Field_MenuUrl,Field_DS_MenuUrl},
                    {AdminMenuModel.Field_MenuOrder,Field_DS_MenuOrder},
                    {AdminMenuModel.Field_MenuLevel,Field_DS_MenuLevel},
                    {AdminMenuModel.Field_IsActive,Field_DS_IsActive},
                    
                };
                return _shareDAO.GetAll(mapDictionary);
            }
            catch (Exception)
            {
                throw;
            }
        }

    }
}
